#
# Common mysql functions
#

############################################################
# Execute an SQL passed in as an argument
# 0 = no errors
############################################################
function mysql_root_execute() {
    if [ $# -eq 1 ]; then
        SQL=$1
        echo "Please enter the ROOT database user, followed by [ENTER]:"
        read ROOT_DB_USER
        
        echo "SQL: $SQL"
        pause '> Press [ENTER] to continue or [CTRL-C] to exit'
        echo ""
        
        echo "Please log into the database with the ROOT user credentials"
        mysql -h localhost -u $ROOT_DB_USER -p <<< "$SQL;"
        return $?
    else
        echo "mysql_root_execute function requires an sql statement. Nothing to do"
        return 0
    fi
}

